<!-- 角色选择下拉框 -->
<template>
  <div>
    <el-select
    multiple
    clearable
    :value="value"
    class="ele-block"
    :placeholder="placeholder"
    @input="updateValue"
  >
    <el-option
      v-for="item in data"
      :key="item.id"
      :value="item.id" 
      :label="item.label"
    />
  </el-select>
  </div>
</template>

<script>
import { consumerAll } from '@/api/consumer';

  export default {
    name: 'CouponSelect',
    props: {
      // 选中的数据(v-modal)
      value: Array,
      // 提示信息
      placeholder: {
        type: String,
        default: '选择优惠券'
      }
    },
    data() {
      return {
        data: []
      };
    },
    created() {
     
      /* 获取角色数据 */
      consumerAll()
        .then((msg) => {
         

          this.data = msg.list

          //  this.data = msg.list.map((item) => {
          //   return {
          //     consumeid: item.id,
          //     label:
          //       item.storeInfo.store_name +
          //       '--满' +
          //       item.satisfy_amount +
          //       '减' +
          //       item.deductible_amount
          //   };
          // });
          loading.close();
        })
     
        .catch((e) => {
          loading.close();
          this.$message.error(e.message);
        });
    },
    methods: {
      updateValue(value) {
        this.$emit('input', value);
      }
    }
  };
</script>
